<?php
session_start();
$auth = $_SESSION['auth'];
if($auth<99)
{
	echo '<center>Non hai l\'autorizzazione per accedere a questa pagina.<br><br><img src="images/accesso_negato.gif"></center>';
	exit();
}
//connessione al database
include 'connect.php';

$id = $_GET['id'];
$username = mysql_query("select username from utenti where id='$id'");
$user = mysql_fetch_row($username);
$pass = md5($user[0]);

$update=mysql_query("update utenti set password='$pass' where id='$id'");

if(!$update) {
?>
<script language="Javascript">
alert("Errore nel reset");
window.location="home.php?page=gestioneutenti";
</script>
<?php
exit();
}
else
{
?>
<script language="Javascript">
alert("Password resettata");
</script>
<?php
}
?>

<script language="Javascript">
browser= navigator.appName;
if (browser == "Netscape")
window.location="home.php?page=gestioneutenti"; else window.location="home.php?page=gestioneutenti"
</script>